﻿using System;
using System.Collections.Generic;
using System.Text;
using ITAP.ShprossesBuilder.Modelling;
using ITAP.Shprosses.CustomPropertyGrid.ComponentsProxy;

namespace ITAP.ShprossesBuilder.ShprossesPropertyGrid.ComponentsProxy
{
    class CreateComponentProxy : IModelVisitor
    {
        public CreateComponentProxy(MainControl mainControl)
        {
            this.mainControl = mainControl;
        }

        private MainControl mainControl;

        private object proxyObject;

        public object ProxyObject
        {
            get { return proxyObject; }
            set { proxyObject = value; }
        }

        #region IModelVisitor Members

        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.Model model)
        {
            throw new NotImplementedException();
        }

        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.Connector connector)
        {
            throw new NotImplementedException();
        }

        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.Shpross shpross)
        {
            ShprossProxy proxy = new ShprossProxy(shpross, mainControl);
            proxyObject = proxy;

        //    throw new NotImplementedException();
        }

        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.Spacer spacer)
        {
            throw new NotImplementedException();
        }

        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.ShprossConnectorStub stub)
        {
            throw new NotImplementedException();
        }

        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.ShprossConnector shprossConnector)
        {
            ShprossConnectorProxy proxy = new ShprossConnectorProxy(shprossConnector, this.mainControl);
            proxyObject = proxy;
        }

        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.SpacerElement spacerElement)
        {
            throw new NotImplementedException();
        }

        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.SpacerConnector spacerConnector)
        {
            throw new NotImplementedException();
        }

        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.ModelCell modelCell)
        {
            proxyObject = new ModelCellProxy(modelCell, mainControl);
//            proxyObject = null;
        }

        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.ModelContainer modelContainer)
        {
            proxyObject = new ModelContainerProxy(mainControl, modelContainer);
        }
        #endregion

        #region IModelVisitor Members


        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.StickConnector stickConnector)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region IModelVisitor Members


        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.SnapOnCap snapOnCap)
        {
            proxyObject = new SnapOnCapProxy(snapOnCap, mainControl);
        }

        #endregion

        #region IModelVisitor Members


        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.ShprossEndToEndConnector endToEndConnector)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region IModelVisitor Members


        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.ShprossChain shprossChain)
        {
        //    throw new NotImplementedException();
        }

        #endregion

        #region IModelVisitor Members


        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.SpacerContainer spacerContainer)
        {
            //throw new NotImplementedException();
        }

        #endregion

        #region IModelVisitor Members


        public void Visit(ITAP.ShprossesBuilder.Modelling.Components.CrossConnector crossConnector)
        {
    //        throw new NotImplementedException();
        }

        #endregion
    }
}
